'\" te
.\"  Copyright (c) 2007, Sun Microsystems, Inc.  All Rights Reserved
.\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License").  You may not use this file except in compliance with the License.
.\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing.  See the License for the specific language governing permissions and limitations under the License.
.\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE.  If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
.TH SIP_COPY_START_LINE 3SIP "Jan 25, 2007"
.SH NAME
sip_copy_start_line, sip_copy_header, sip_copy_header_by_name,
sip_copy_all_headers \- copy headers from a SIP message
.SH SYNOPSIS
.LP
.nf
\fBcc\fR [ \fIflag\fR ... ] \fIfile\fR ... \fB-lsip\fR [ \fIlibrary\fR ... ]
#include <sip.h>

\fBint\fR \fIsip_copy_start_line\fR(\fBsip_msg_t\fR \fIfrom_msg\fR, \fBsip_msg_t\fR \fIto_msg\fR);
.fi

.LP
.nf
\fBint\fR \fIsip_copy_header\fR(\fBsip_msg_t\fR \fIsip_msg\fR, \fBsip_header_t\fR \fIsip_header\fR,
     \fBchar *\fR\fIparam\fR);
.fi

.LP
.nf
\fBint\fR \fIsip_copy_header_by_name\fR(\fBsip_msg_t\fR \fIfrom_msg\fR, \fBsip_msg_t\fR \fIto_msg\fR,
     \fBchar *\fR\fIheader_name\fR, \fBchar *\fR\fIparam\fR);
.fi

.LP
.nf
\fBint\fR \fIsip_copy_all_headers\fR(\fBsip_msg_t\fR \fIfrom_msg\fR, \fBsip_msg_t\fR \fIto_msg\fR);
.fi

.SH DESCRIPTION
.sp
.LP
The \fBsip_copy_start_line()\fR function copies the start line, a request or a
response line, from \fIfrom_msg\fR to \fIto_msg\fR.
.sp
.LP
The \fBsip_copy_header()\fR function copies the \fBSIP\fR header specified by
\fIsip_header\fR to the \fBSIP\fR message \fIsip_msg\fR. A new \fBSIP\fR header
is created from \fIsip_header\fR and \fIparam\fR, and is appended to
\fIsip_msg\fR. The \fIparam\fR can be non-null.
.sp
.LP
The \fBsip_copy_header_by_name()\fR function copies the header specified by
\fIheader_name\fR (long or short form) from \fIfrom_msg\fR to \fIto_msg\fR. The
new header is created using the header value from \fIfrom_msg\fR and
\fIparam\fR, if non-null, and appended to \fIto_msg\fR.
.sp
.LP
The \fBsip_copy_all_headers()\fR copies all the headers from \fIfrom_msg\fR to
\fIto_msg\fR.
.SH RETURN VALUES
.sp
.LP
These functions return \fB0\fR on success and the appropriate error on failure.
.sp
.LP
The value of \fBerrno\fR is not changed by these calls in the event of an
error.
.SH ERRORS
.sp
.LP
These functions can return one of the following errors in case of failure:
.sp
.ne 2
.na
\fB\fBEINVAL\fR\fR
.ad
.RS 10n
If the required input parameters are \fBNULL\fR or if the header being copied
does not exist or is deleted in source \fBSIP\fR message.
.RE

.sp
.ne 2
.na
\fB\fBENOMEM\fR\fR
.ad
.RS 10n
Error while allocating memory for creating the new header.
.RE

.sp
.ne 2
.na
\fB\fBEPERM\fR\fR
.ad
.RS 10n
If the input SIP message cannot be modified.
.RE

.SH ATTRIBUTES
.sp
.LP
See \fBattributes\fR(7) for descriptions of the following attributes:
.sp

.sp
.TS
box;
c | c
l | l .
ATTRIBUTE TYPE	ATTRIBUTE VALUE
_
Interface Stability	Committed
_
MT-Level	MT-Safe
.TE

.SH SEE ALSO
.sp
.LP
.BR libsip (3LIB)
